﻿<!DOCTYPE html>
<html >
<head>

	<link rel="stylesheet" href="dojo/dijit/themes/claro/claro.css">
	
	<script>dojoConfig = { async: true, parseOnLoad: false }</script>
	<script src='dojo/dojo/dojo.js'></script>
	
	<script>
	    require(["dojo/topic", "dojo/dom", "dojo/on", "dojo/domReady!"],
        function (topic, dom, on) {

            var handle = topic.subscribe("some/topic", function (e) {
                dom.byId("output").innerHTML = "邮件已经发送给: " + e.msg;
                handle.remove();
            });

            on(dom.byId("publish"), "click", function () {
                topic.publish("some/topic", { msg: "小王" });
            });

        });
	</script>
</head>
<body class="claro">
    <button type="button" id="publish">请单击</button>
    <div id="output">输出信息</div>
</body>
</html>